<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>播放历史 - 声破天音乐</title>
    <link rel="stylesheet" href="assets/css/main.css">
    <link rel="stylesheet" href="assets/css/history.css">
    <link rel="stylesheet" href="assets/css/player-bar.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
</head>
<body>
    <div class="main-container">
        <!-- 侧边导航栏 -->
        <aside class="sidebar">
            <div class="logo">
                <a href="landing.html">
                    <svg viewBox="0 0 200 50" xmlns="http://www.w3.org/2000/svg">
                        <circle cx="25" cy="25" r="20" fill="#1DB954" />
                        <path d="M18 27.5C18 27.5 22 23.5 25 23.5C28 23.5 32 27.5 32 27.5" stroke="black" stroke-width="2" fill="none" />
                        <path d="M16 21.5C16 21.5 22 15.5 25 15.5C28 15.5 34 21.5 34 21.5" stroke="black" stroke-width="2" fill="none" />
                        <path d="M14 15.5C14 15.5 21 7.5 25 7.5C29 7.5 36 15.5 36 15.5" stroke="black" stroke-width="2" fill="none" />
                        <text x="50" y="32" font-family="Arial, sans-serif" font-size="24" font-weight="bold" fill="white">声破天</text>
                    </svg>
                </a>
            </div>
            <nav class="main-nav">
                <ul>
                    <li class="nav-item">
                        <a href="index.html"><i class="fas fa-home"></i> <span data-i18n="nav_home">首页</span></a>
                    </li>
                    <li class="nav-item">
                        <a href="search.html"><i class="fas fa-search"></i> <span data-i18n="nav_search">搜索</span></a>
                    </li>
                    <li class="nav-item">
                        <a href="explore.html"><i class="fas fa-compass"></i> <span data-i18n="nav_explore">探索</span></a>
                    </li>
                    <li class="nav-item">
                        <a href="library.html"><i class="fas fa-book"></i> <span data-i18n="nav_library">音乐库</span></a>
                    </li>
                </ul>
            </nav>

            <div class="library-nav">
                <div class="library-header">
                    <h2><i class="fas fa-plus-square"></i> <span data-i18n="create_playlist">创建播放列表</span></h2>
                </div>
                <div class="library-items">
                    <div class="library-item">
                        <div class="liked-songs">
                            <div class="liked-gradient">
                                <i class="fas fa-heart"></i>
                            </div>
                            <h3 data-i18n="liked_songs">我喜欢的歌曲</h3>
                            <p><span data-i18n="playlist">播放列表</span> • 32 <span data-i18n="songs">首歌曲</span></p>
                        </div>
                    </div>
                    <div class="playlists">
                        <div class="playlist-item">
                            <a href="#" id="following-link" style="text-decoration: none; color: inherit;">
                                <h3 data-i18n="playlist_1">我的关注</h3>
                                <p data-i18n="playlist_by_user">播放列表 • 用户</p>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </aside>

        <!-- 主内容区 -->
        <main class="content">
            <header class="top-bar">
                <div class="navigation-buttons">
                    <button class="nav-btn"><i class="fas fa-chevron-left"></i></button>
                    <button class="nav-btn"><i class="fas fa-chevron-right"></i></button>
                </div>
                <div class="user-menu">
                    <div class="language-selector">
                        <div class="language-options">
                            <button class="language-btn" data-lang="zh-CN">简体中文</button>
                            <button class="language-btn" data-lang="en">English</button>
                            <button class="language-btn" data-lang="zh-TW">繁體中文</button>
                        </div>
                    </div>
                    <div class="auth-buttons">
                        <a href="login.html" class="login-btn"><i class="fas fa-sign-in-alt"></i> <span data-i18n="login">登录</span></a>
                        <a href="register.html" class="register-btn"><i class="fas fa-user-plus"></i> <span data-i18n="register">注册</span></a>
                    </div>
                </div>
            </header>

            <!-- 播放历史内容 -->
            <div class="content-container history-container">
                <div class="history-header">
                    <div class="header-left">
                        <h1 class="history-title">播放历史</h1>
                        <p class="history-description">查看您最近播放的歌曲和艺术家</p>
                    </div>
                    <div class="header-right">
                        <div class="history-actions">
                            <div class="period-filter">
                                <select id="history-period">
                                    <option value="week">最近一周</option>
                                    <option value="month" selected>最近一个月</option>
                                    <option value="year">最近一年</option>
                                    <option value="all">全部历史</option>
                                </select>
                            </div>
                            <button class="clear-history-btn"><i class="fas fa-trash"></i> 清除历史</button>
                        </div>
                    </div>
                </div>

                <div class="history-tabs">
                    <button class="tab-btn active" data-tab="tracks">歌曲</button>
                    <button class="tab-btn" data-tab="artists">艺术家</button>
                    <button class="tab-btn" data-tab="albums">专辑</button>
                    <button class="tab-btn" data-tab="playlists">播放列表</button>
                </div>

                <!-- 歌曲历史 -->
                <div class="tab-content active" id="tracks-content">
                    <div class="history-list">
                        <div class="history-list-header">
                            <div class="track-number">#</div>
                            <div class="track-info">标题</div>
                            <div class="track-album">专辑</div>
                            <div class="track-date">播放时间</div>
                            <div class="track-duration">时长</div>
                            <div class="track-options"></div>
                        </div>

                        <div class="history-tracks">
                            <div class="track-item">
                                <div class="track-number">1</div>
                                <div class="track-info">
                                    <div class="track-image">
                                        <img src="assets/images/covers/cover2.jpg" alt="歌曲封面">
                                    </div>
                                    <div class="track-details">
                                        <div class="track-name">晴天</div>
                                        <div class="track-artist">周杰伦</div>
                                    </div>
                                </div>
                                <div class="track-album">叶惠美</div>
                                <div class="track-date">今天 14:35</div>
                                <div class="track-duration">4:30</div>
                                <div class="track-options">
                                    <button class="option-btn"><i class="fas fa-heart"></i></button>
                                    <button class="option-btn"><i class="fas fa-ellipsis-h"></i></button>
                                </div>
                            </div>

                            <div class="track-item">
                                <div class="track-number">2</div>
                                <div class="track-info">
                                    <div class="track-image">
                                        <img src="assets/images/covers/cover3.jpg" alt="歌曲封面">
                                    </div>
                                    <div class="track-details">
                                        <div class="track-name">Believer</div>
                                        <div class="track-artist">Imagine Dragons</div>
                                    </div>
                                </div>
                                <div class="track-album">Evolve</div>
                                <div class="track-date">今天 13:22</div>
                                <div class="track-duration">3:24</div>
                                <div class="track-options">
                                    <button class="option-btn"><i class="fas fa-heart"></i></button>
                                    <button class="option-btn"><i class="fas fa-ellipsis-h"></i></button>
                                </div>
                            </div>

                            <div class="track-item">
                                <div class="track-number">3</div>
                                <div class="track-info">
                                    <div class="track-image">
                                        <img src="assets/images/covers/cover5.jpg" alt="歌曲封面">
                                    </div>
                                    <div class="track-details">
                                        <div class="track-name">起风了</div>
                                        <div class="track-artist">买辣椒也用券</div>
                                    </div>
                                </div>
                                <div class="track-album">起风了</div>
                                <div class="track-date">今天 10:15</div>
                                <div class="track-duration">5:11</div>
                                <div class="track-options">
                                    <button class="option-btn"><i class="fas fa-heart"></i></button>
                                    <button class="option-btn"><i class="fas fa-ellipsis-h"></i></button>
                                </div>
                            </div>

                            <div class="track-item">
                                <div class="track-number">4</div>
                                <div class="track-info">
                                    <div class="track-image">
                                        <img src="assets/images/covers/cover7.jpg" alt="歌曲封面">
                                    </div>
                                    <div class="track-details">
                                        <div class="track-name">Shape of You</div>
                                        <div class="track-artist">Ed Sheeran</div>
                                    </div>
                                </div>
                                <div class="track-album">÷ (Divide)</div>
                                <div class="track-date">昨天 19:48</div>
                                <div class="track-duration">3:53</div>
                                <div class="track-options">
                                    <button class="option-btn"><i class="fas fa-heart"></i></button>
                                    <button class="option-btn"><i class="fas fa-ellipsis-h"></i></button>
                                </div>
                            </div>

                            <div class="track-item">
                                <div class="track-number">5</div>
                                <div class="track-info">
                                    <div class="track-image">
                                        <img src="assets/images/covers/cover4.jpg" alt="歌曲封面">
                                    </div>
                                    <div class="track-details">
                                        <div class="track-name">你的答案</div>
                                        <div class="track-artist">阿冗</div>
                                    </div>
                                </div>
                                <div class="track-album">你的答案</div>
                                <div class="track-date">昨天 18:32</div>
                                <div class="track-duration">3:32</div>
                                <div class="track-options">
                                    <button class="option-btn"><i class="fas fa-heart"></i></button>
                                    <button class="option-btn"><i class="fas fa-ellipsis-h"></i></button>
                                </div>
                            </div>

                            <div class="track-item">
                                <div class="track-number">6</div>
                                <div class="track-info">
                                    <div class="track-image">
                                        <img src="assets/images/covers/cover10.jpg" alt="歌曲封面">
                                    </div>
                                    <div class="track-details">
                                        <div class="track-name">光年之外</div>
                                        <div class="track-artist">G.E.M.邓紫棋</div>
                                    </div>
                                </div>
                                <div class="track-album">摩天动物园</div>
                                <div class="track-date">昨天 16:05</div>
                                <div class="track-duration">4:17</div>
                                <div class="track-options">
                                    <button class="option-btn"><i class="fas fa-heart"></i></button>
                                    <button class="option-btn"><i class="fas fa-ellipsis-h"></i></button>
                                </div>
                            </div>

                            <div class="track-item">
                                <div class="track-number">7</div>
                                <div class="track-info">
                                    <div class="track-image">
                                        <img src="assets/images/covers/cover1.jpg" alt="歌曲封面">
                                    </div>
                                    <div class="track-details">
                                        <div class="track-name">Bad Guy</div>
                                        <div class="track-artist">Billie Eilish</div>
                                    </div>
                                </div>
                                <div class="track-album">WHEN WE ALL FALL ASLEEP, WHERE DO WE GO?</div>
                                <div class="track-date">前天 20:15</div>
                                <div class="track-duration">3:14</div>
                                <div class="track-options">
                                    <button class="option-btn"><i class="fas fa-heart"></i></button>
                                    <button class="option-btn"><i class="fas fa-ellipsis-h"></i></button>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="load-more">
                        <button class="load-more-btn">加载更多</button>
                    </div>
                </div>

                <!-- 艺术家历史 (默认隐藏) -->
                <div class="tab-content" id="artists-content">
                    <div class="card-grid">
                        <div class="artist-card">
                            <div class="artist-img">
                                <img src="assets/images/artists/artist1.jpg" alt="周杰伦">
                            </div>
                            <h3 class="artist-name">周杰伦</h3>
                            <p class="artist-meta">上次收听：今天</p>
                        </div>
                        
                        <div class="artist-card">
                            <div class="artist-img">
                                <img src="assets/images/artists/artist2.jpg" alt="Imagine Dragons">
                            </div>
                            <h3 class="artist-name">Imagine Dragons</h3>
                            <p class="artist-meta">上次收听：今天</p>
                        </div>
                        
                        <div class="artist-card">
                            <div class="artist-img">
                                <img src="assets/images/artists/artist3.jpg" alt="买辣椒也用券">
                            </div>
                            <h3 class="artist-name">买辣椒也用券</h3>
                            <p class="artist-meta">上次收听：今天</p>
                        </div>
                        
                        <div class="artist-card">
                            <div class="artist-img">
                                <img src="assets/images/artists/artist4.jpg" alt="Ed Sheeran">
                            </div>
                            <h3 class="artist-name">Ed Sheeran</h3>
                            <p class="artist-meta">上次收听：昨天</p>
                        </div>
                        
                        <div class="artist-card">
                            <div class="artist-img">
                                <img src="assets/images/artists/artist5.jpg" alt="阿冗">
                            </div>
                            <h3 class="artist-name">阿冗</h3>
                            <p class="artist-meta">上次收听：昨天</p>
                        </div>
                        
                        <div class="artist-card">
                            <div class="artist-img">
                                <img src="assets/images/artists/artist6.jpg" alt="G.E.M.邓紫棋">
                            </div>
                            <h3 class="artist-name">G.E.M.邓紫棋</h3>
                            <p class="artist-meta">上次收听：昨天</p>
                        </div>
                    </div>
                    
                    <div class="load-more">
                        <button class="load-more-btn">加载更多</button>
                    </div>
                </div>

                <!-- 专辑历史 (默认隐藏) -->
                <div class="tab-content" id="albums-content">
                    <div class="card-grid">
                        <!-- 专辑卡片内容 -->
                    </div>
                </div>

                <!-- 播放列表历史 (默认隐藏) -->
                <div class="tab-content" id="playlists-content">
                    <div class="card-grid">
                        <!-- 播放列表卡片内容 -->
                    </div>
                </div>
            </div>
        </main>
    </div>

    <!-- 播放器栏 -->
    <footer class="player-bar">
        <div class="now-playing">
            <div class="track-info">
                <div class="track-image" title="点击查看歌词">
                    <img src="assets/images/covers/cover2.jpg" alt="当前播放歌曲">
                </div>
                <div class="track-details">
                    <h4 class="track-name">当前</h4>
                    <p class="artist-name">晴天 - 周杰伦</p>
                </div>
            </div>
            <div class="track-actions">
                <button class="action-btn"><i class="far fa-heart"></i></button>
                <button class="action-btn"><i class="fas fa-external-link-alt"></i></button>
            </div>
        </div>

        <div class="player-controls">
            <div class="control-buttons">
                <button class="control-btn"><i class="fas fa-random"></i></button>
                <button class="control-btn"><i class="fas fa-step-backward"></i></button>
                <button class="control-btn play-btn"><i class="fas fa-play"></i></button>
                <button class="control-btn"><i class="fas fa-step-forward"></i></button>
                <button class="control-btn"><i class="fas fa-redo"></i></button>
            </div>
            <div class="playback-bar">
                <span class="current-time">0:00</span>
                <div class="progress-bar">
                    <div class="progress"></div>
                    <div class="progress-handle"></div>
                </div>
                <span class="total-time">0:00</span>
            </div>
        </div>

        <div class="player-options">
            <button class="option-btn"><i class="fas fa-list"></i></button>
            <button class="option-btn"><i class="fas fa-desktop"></i></button>
            <div class="volume-control">
                <button class="option-btn"><i class="fas fa-volume-up"></i></button>
                <div class="volume-bar">
                    <div class="volume-level" style="width: 70%"></div>
                    <div class="volume-handle" style="left: 70%"></div>
                </div>
            </div>
        </div>
    </footer>

    <script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script>
    <script src="assets/js/app.js"></script>
    <script src="assets/js/i18n.js"></script>
    <script src="assets/js/player.js"></script>
    <script src="assets/js/navigation.js"></script>
    <script src="assets/js/sidebar-utils.js"></script>
    
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // 初始化专辑封面点击事件
            initPlayerCoverClick();
            
            // 选项卡切换功能
            const tabButtons = document.querySelectorAll('.tab-btn');
            const tabContents = document.querySelectorAll('.tab-content');
            
            tabButtons.forEach(button => {
                button.addEventListener('click', () => {
                    // 移除所有激活状态
                    tabButtons.forEach(btn => btn.classList.remove('active'));
                    tabContents.forEach(content => content.classList.remove('active'));
                    
                    // 激活当前选项卡
                    button.classList.add('active');
                    const tabId = button.getAttribute('data-tab');
                    document.getElementById(`${tabId}-content`).classList.add('active');
                });
            });
            
            // 历史筛选功能
            const historyPeriod = document.getElementById('history-period');
            
            historyPeriod.addEventListener('change', () => {
                // 这里可以添加筛选逻辑
                console.log('Period changed to:', historyPeriod.value);
            });
            
            // 清除历史按钮功能
            const clearHistoryBtn = document.querySelector('.clear-history-btn');
            
            clearHistoryBtn.addEventListener('click', () => {
                if (confirm('确定要清除播放历史吗？此操作不可撤销。')) {
                    // 这里可以添加清除历史的逻辑
                    console.log('History cleared');
                }
            });
            
            // 歌曲列表交互
            const trackItems = document.querySelectorAll('.track-item');
            
            trackItems.forEach(item => {
                item.addEventListener('mouseenter', () => {
                    const trackNumber = item.querySelector('.track-number');
                    const playButton = document.createElement('button');
                    playButton.className = 'play-button';
                    playButton.innerHTML = '<i class="fas fa-play"></i>';
                    
                    trackNumber.innerHTML = '';
                    trackNumber.appendChild(playButton);
                });
                
                item.addEventListener('mouseleave', () => {
                    const trackNumber = item.querySelector('.track-number');
                    const index = Array.from(trackItems).indexOf(item) + 1;
                    trackNumber.innerHTML = index;
                });
            });
            
            // 加载更多按钮功能
            const loadMoreBtns = document.querySelectorAll('.load-more-btn');
            
            loadMoreBtns.forEach(btn => {
                btn.addEventListener('click', () => {
                    // 这里可以添加加载更多内容的逻辑
                    console.log('Loading more content');
                    btn.textContent = '加载中...';
                    
                    // 模拟加载延迟
                    setTimeout(() => {
                        btn.textContent = '加载更多';
                    }, 1500);
                });
            });
        });
    </script>
</body>
</html>